const allServices = require('../config/mysqlconfig')

// 主页的数据
const getIndexData = ()=>{
    let _sql = "SELECT * FROM `index`" 
    return allServices.query(_sql)
}

// 获取门票数据
const getTickets = (type)=>{ 
    let _sql  = `select * from tickets where type="${type}" `
    return allServices.query(_sql)
}

// 获取详情页商品数据
const getDEtail = (id)=>{
    let _sql = `select * from detail where id = "${id}"`
    return allServices.query(_sql)
}
// 轮播图
const getSwiper = (id)=>{
    let _sql = `select * from swiperimg where id = "${id}"`
    return allServices.query(_sql)
}
// 详情图
const getImg = (id)=>{
    let _sql = `select * from  descriptimg where id="${id}" `
    return allServices.query(_sql)
}

// 获取用户的订单信息
const getOrderList = (id)=>{
    let _sql = `select * from orders where userId= "${id}" `
    return allServices.query(_sql)
}
module.exports = {
    getIndexData,
    getTickets,
    getDEtail,
    getSwiper,
    getImg,
    getOrderList
}